package com.topone.dataObject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.topone.Enum.CouponEnum;
import com.topone.Utils.EnumUnitl;
import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 优惠券信息
 * Created by Administrator on 2017/11/6,0006.
 */
@Entity
@DynamicUpdate
@Data
public class TcCoupon {
    @Id
    private String couponId;        //优惠券Id
    private String couponCode;      //优惠券code
    private String couponName;      //优惠券名称
    private Integer couponType;  //优惠券种类
    private Integer couponStock;      //优惠券数量
    private BigDecimal couponPrice; //优惠券价格
    private BigDecimal discountPrice; //抵扣价
    private Integer   creditPrice;   //积分价格
    private  String useCondition;    //折扣最低条件
    private String couponRank;      //优惠券使用范围
    private Integer couponStatus=CouponEnum.UP.getCode();    //优惠券状态
    private String couponIcon;       //优惠券图标
    private String bussinessId;     //商家id
    private Integer isFlashsale;    //是否为限时抢购优惠券
    private Date activityDurationStart;  //活动开始有效期
    private Date activityDurationEnd;  //活动结束有效期
    private Date useDurationStart;       //消费开始有效期
    private Date useDurationEnd;       //消费结束有效期
    private Date createTime;
    private Date updateTime;

    //private  Bussiness bussiness;

    @JsonIgnore
    public CouponEnum getCouponEnum(){
        return  EnumUnitl.getByCode(couponStatus,CouponEnum.class);

    }
}
